use futures::executor::block_on;

struct Song {}

async fn learn_song() -> Song {
    println!("learn song");
    Song {}
}

async fn sing_song(song: Song) {
    println!("sing song");
}

async fn dance() {
    println!("dance")
}

async fn learn_and_sing() {
    let song = learn_song().await;
    sing_song(song).await;
}

async fn async_main() {
    let f1 = learn_and_sing();
    let f2 = dance();
    futures::join!(f1,f2);
}

fn main() {
    // 这种方式会阻塞线程，实际上还是会依次执行，没有并发执行
    // let song = block_on(learn_song());
    // block_on(sing_song(song));
    // block_on(dance());

    // 这种方式不会阻塞线程，可以并发
    block_on(async_main());
}
